import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_levin/config/router_manager.dart';

class SplashPage extends StatefulWidget {
  const SplashPage({super.key});

  @override
  State<StatefulWidget> createState() {
    return _SplashPageState();
  }
}

class _SplashPageState extends State<SplashPage> {
  Timer? _timer;

  @override
  void initState() {
    super.initState();
    _timer = Timer(const Duration(seconds: 3), () {
      //showToast('倒计时结束');
      Navigator.pushNamed(context, RouteName.home);
    });
  }

  @override
  void dispose() {
    super.dispose();
    _timer?.cancel();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.black,
      padding: const EdgeInsets.only(bottom: 56),
      alignment: Alignment.bottomCenter,
      child: Image.asset(
        'assets/images/ic_splash_logo.png',
        width: 180,
        height: 80,
      ),
    );
  }
}
